#pragma once

#include <string>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <camera_modul.hpp>

// 读取参数类

class ReadParameter{
    

public:

    ReadParameter(const std::string& filename){

        cv::FileStorage fs(filename, cv::FileStorage::READ);
        if (!fs.isOpened()){
            std::cout << "FILE ERROR !!!" << std::endl;
            badFile = true;
        }
        // image topic name
        if (!fs["image1_topic"].isNone() && !fs["image2_topic"].isNone()){
            image1_topic = static_cast<std::string>(fs["image1_topic"]);
            image2_topic = static_cast<std::string>(fs["image2_topic"]);
        }
        // groundtruth topic name 
        if (!fs["groundTruth_topic"].isNone()){
            groundTruth_topic = static_cast<std::string>(fs["groundTruth_topic"]);
        }
        // 
        if (!fs["nFeatures"].isNone()){
            nFeatures = static_cast<int>(fs["nFeatures"]);
            fScaleFactor = static_cast<float>(fs["fScaleFactor"]);;
            nLevels = static_cast<int>(fs["nLevels"]);
            fIniThFAST = static_cast<int>(fs["fIniThFAST"]);
            fMinThFAST = static_cast<int>(fs["fMinThFAST"]);
        }

        // type
        if (!fs["runMode"].isNone()){
            runMode = static_cast<std::string>(fs["runMode"]);
        }
    }
    ~ReadParameter(){}
    

    bool badFile = false;
    // all parameter from read
    std::string image1_topic;
    std::string image2_topic;

    std::string groundTruth_topic;

    std::string runMode = "build";

    // orb & default param
    int nFeatures = 1200;  
    double fScaleFactor = 1.2;
    int nLevels = 8;
    int fIniThFAST = 20;
    int fMinThFAST = 7;


};






